package Controllers;

import SwingComponents.CongratulationsPanel;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import javax.swing.JPanel;

public class CongratulationsController {

    private PrincipalController principalController;
    private CongratulationsPanel congratulationsPanel;
    private JPanel backPanel;

    public CongratulationsController(PrincipalController principalController, CongratulationsPanel congratulationsPanel) {
        this.principalController = principalController;
        this.congratulationsPanel = congratulationsPanel;
        backPanel = new JPanel();
        backPanel.setSize(new Dimension(465, 485));
        backPanel.setMaximumSize(new Dimension(465, 485));
        backPanel.setMinimumSize(new Dimension(465, 485));
        backPanel.setPreferredSize(new Dimension(465, 485));
        backPanel.setBackground(Color.BLACK);
    }

    public void execute() {
        congratulationsPanel.setVisible(true);
        backPanel.add(congratulationsPanel);
        principalController.getApplication().add(backPanel, BorderLayout.CENTER);
        long initTime = System.currentTimeMillis();
        while (initTime + 10000 > System.currentTimeMillis()) {
        }
        principalController.getApplication().remove(backPanel);
        principalController.getPrincipalPanel().setVisible(true);

    }
}
